<template>
<div class="nav-bar">
  <div class="left">
    <svg t="1651548745816"  @click="goBack" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="15069" width="32" height="32"><path d="M677.391515 873.916768c-7.86101 0-15.618586-2.999596-21.617778-8.895354L324.473535 533.721212c-11.998384-11.894949-11.998384-31.340606 0-43.235555L655.670303 159.288889c5.999192-5.999192 13.756768-8.895354 21.617778-8.895354 7.757576 0 15.618586 2.999596 21.617778 8.895354 11.894949 11.894949 11.894949 31.237172 0 43.235555L389.223434 512.103434 698.905859 821.785859c11.894949 11.998384 11.894949 31.340606 0 43.235555-5.895758 5.895758-13.756768 8.895354-21.514344 8.895354z m0 0" p-id="15070" fill="#dbdbdb"></path></svg>
  </div>
  <div class="center">
    <slot></slot>
  </div>
  <div class="right">
    <slot name="right"></slot>
  </div>
</div>
</template>

<script>
import {useRouter} from 'vue-router'
export default {
  name: "NavBar",
  setup(){
    const router=useRouter()
   const goBack=()=>{
      router.back()
    }
    return{
     goBack
    }
  }
}
</script>

<style scoped>
.nav-bar{
  display: flex;
  flex:1;
  text-align: center;
  box-shadow: 0 2px 0px rgba(100,100,100,0.1);
  background-color:#42b983;
  color: white;
  position:fixed;
  left: 0;
  right: 0;
  top:0;
  z-index: 9;
   height: 45px;
  line-height: 45px;
}
.left,.right,.center{
  float: left;
}
.left,.right{
  width: 60px;
}
.center{
  flex: 1;
}
svg{
  position:relative;
  top:7px
}
</style>
